package club.xcgame520.picturepickerdemo;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AppCompatActivity;

import club.xcgame520.picturepicker.PicturePickerActivity;

public class MainActivity extends AppCompatActivity {

    private String providerName = "club.xcgame520.picturepickerdemo.provider";

    private Button bP;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        bP = findViewById(R.id.bP);
        bP.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PicturePickerActivity.startSingleSelector(MainActivity.this, providerName, 1);
            }
        });

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 1 && resultCode == RESULT_OK && data != null) {

            Log.d("xiaocan", 1111 + "");

        }

    }
}
